<template>
  <div class="store-header">
    <div class="logo">
      <img v-bind:src="store.logo" width="50" />
    </div>
    <div class="info">
      <h3>{{store.name}}</h3>
      <stars v-bind:score="4.25" v-bind:size="24"></stars>
      <span>description</span>
    </div>

    <a class="btn-show-info" href="javascript:;"
      v-on:click="showStoreInfo">Detail</a>

    <div class="background" v-bind:style="{
        'background-image': 'url(' + store.logo + ')',
        '-webkit-filter': 'blur(15px)'
      }"></div>
  </div>
</template>

<script>
import Stars from 'components/Stars'

export default {
  name: 'StoreHeader',

  components: {
    Stars
  },

  props: {
    store: {
      type: Object,
      default() {
        return {
          id: 0,
          name: 'STORE NAME',
          logo: 'https://vuejs.org/images/logo.png'
        }
      }
    }
  },

  methods: {
    showStoreInfo() {
      console.log('header.click')
      this.$emit('show-store-info', this.store)
    }
  }
}
</script>

<style lang="less" scoped>
.store-header {
  position: relative;
  overflow: hidden;
  height: 100px;
  padding: 15px;
  background-color: #333;
  font-size: 0;

  .logo, .info {
    z-index: 10;
    position: relative;
    display: inline-block;
    vertical-align: top;
  }

  .logo {
    margin-right: 10px;
  }

  .info {
    font-size: 16px;
    color: #fff;

    h3 {
      margin: 0 0 5px 0;
    }
  }

  .btn-show-info {
    z-index: 20;
    display: block;
    position: absolute;
    right: 20px;
    bottom: 15px;
    padding: 5px 15px;
    border-radius: 500px;
    background-color: rgba(0, 0, 0, 0.5);
    font-size: 14px;
    color: #fff;
  }

  .background {
    z-index: 0;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    -webkit-filter: blur(15px);
    filter: blur(15px);
    opacity: 0.5;
  }
}
</style>
